package cn.stylefeng.guns.modular.business.mapper;

import cn.stylefeng.guns.modular.business.entity.MoneyLog;
import cn.stylefeng.guns.modular.business.model.dto.AmountQueryCondition;
import cn.stylefeng.guns.modular.business.model.params.MoneyLogParam;
import cn.stylefeng.guns.modular.business.model.result.MoneyLogResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 金额变动表 Mapper 接口
 * </p>
 *
 * @author jwj
 * @since 2019-07-16
 */
@Repository
public interface MoneyLogMapper extends BaseMapper<MoneyLog> {

    /**
     * 获取列表
     *
     * @author jwj
     * @Date 2019-07-16
     */
    List<MoneyLogResult> customList(@Param("paramCondition") MoneyLogParam paramCondition);

    /**
     * 获取map列表
     *
     * @author jwj
     * @Date 2019-07-16
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") MoneyLogParam paramCondition);

    /**
     * 获取分页实体列表
     *
     * @author jwj
     * @Date 2019-07-16
     */
    Page<MoneyLogResult> customPageList(@Param("page") Page page, @Param("paramCondition") MoneyLogParam paramCondition);

    /**
     * 获取分页map列表
     *
     * @author jwj
     * @Date 2019-07-16
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") MoneyLogParam paramCondition);

    /**
     * 获取用户直推列表
     * @param paramCondition
     * @return
     */
    List<MoneyLogResult> getZPushMoneyListByIds(@Param("paramCondition") MoneyLogParam paramCondition);


    /**
     * 获取我的推荐收益
     * @param userId
     * @return
     */
    BigDecimal getMyTeamTotal(@Param("userId") Long userId);


    /**
     * 统计用户余额
     *
     * @param userId
     * @return
     */
    BigDecimal totalAmount(@Param("userId") Long userId);


    List<MoneyLogResult> record(@Param("page") Page page, @Param("userId") Long userId,@Param("amountQueryCondition") AmountQueryCondition amountQueryCondition);

}
